<?php
/* @var $this RegHealthPolicyController */
/* @var $model RegHealthPolicy */


$this->breadcrumbs=array(
	'Reg Health Policies'=>array('index'),
	'Manage',
);

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$('#reg-health-policy-grid').yiiGridView('update', {
		data: $(this).serialize()
	});
	return false;
});
");
?>

<h1>Health Policiy Registration</h1>
<a href="<?php echo Yii::app()->createUrl('regHealthPolicy/create'); ?>" class="btn btn-sm btn-primary">Add New</a><br /><br />



<?php echo CHtml::link('Search','#',array('class'=>'search-button btn')); ?>
<div class="search-form" style="display:none">
<?php $this->renderPartial('_search',array(
	'model'=>$model,
)); ?>
</div><!-- search-form -->

<?php $this->widget('bootstrap.widgets.TbGridView',array(
	'id'=>'reg-health-policy-grid',
	'dataProvider'=>$model->search(),
	//'filter'=>$model,
	'columns'=>array(
		//'id',
		array(
			'name'=>'mst_client_id',
			'value'=>'MstClient::model()->findByPk($data->mst_client_id)->name',
		),
		array(
			'name'=>'mst_jns_asuransi_id',
			'value'=>'MstJnsAsuransi::model()->findByPk($data->mst_jns_asuransi_id)->name',
		),
		array(
			'name'=>'mst_perusahaan_asuransi_id',
			'value'=>'MstPerusahaanAsuransi::model()->findByPk($data->mst_perusahaan_asuransi_id)->name',
		),
		'policy_no',
		array(
			'name'=>'start_periode',
			'value'=>'date("d-m-Y",strtotime($data->start_periode))',
			),
		array(
			'name'=>'end_periode',
			'value'=>'date("d-m-Y",strtotime($data->end_periode))',
			),
		/*
		
		'remarks',
		'mst_currency_id',
		'jml_installment',
		'createdby',
		'createdtime',
		'updatedby',
		'updatedtime',
		*/
		array(
                'class'=>'bootstrap.widgets.TBButtonColumn',
               'template' => '{view}{update}{delete}',
               'buttons' => array(
               				'view' => array(
								'options'=>array(
								'class'=>'btn btn-small view'
								)
                            ),

               				'update' => array(
								'options'=>array(
								'class'=>'btn btn-small update'
								)
                            ),


                            'delete' => array(
                              'options'=>array(
                                   'class'=>'btn btn-small delete'
                                   ),
                            ),

               ),
            'htmlOptions'=>array('style'=>'width: 150px'),
           )
	),
)); ?>